class MathDojo
		
	attr_accessor :value
	def initialize()
		@value = 0	
	end

	def add(*numb)
		@value += numb.reduce(:+)	
		self	
	end
	def subtract(*numb)
		@value = @value - numb.reduce(:+)
		self
	end

end

class MathDojo_witharray
		
	attr_accessor :value
	def initialize()
		@value = 0	
	end

	# the while statement goes through each value in numb to see if it is a fixnum or an array. If it is a fixnum it will add it to the value otherwise it will add the array together before adding it to the value. 
	def add(*numb)
		$i = 0
		while $i < numb.length
			if numb[$i].class == Fixnum
				@value += numb[$i]
			else	
				@value += numb[$i].reduce(:+)	
			end
			$i += 1
		end	
		self
	end
	
	def subtract(*numb)
		$i = 0
		while $i < numb.length
			if numb[$i].class == Fixnum
				@value -= numb[$i]
			else	
				@value -= numb[$i].reduce(:+)	
			end
			$i += 1
		end	
		self
	end
end

# puts MathDojo_witharray.new.add(1).add([3,5,7,8], [2, 4.3, 1.25]).subtract([2,3], [1.1, 2.3]).value
